﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace NetDiskPRJ.NetDisk
{
    public partial class DirNameInputDlgForm : Base.DlgForm
    {
        private Model.CommonDlgParameters commonDlgModel = new Model.CommonDlgParameters();
        public string NewName = "";

        public DirNameInputDlgForm(Model.CommonDlgParameters CommonDlgParameters)
        {
            InitializeComponent();
            commonDlgModel = CommonDlgParameters;
        }

        private void btnSave_Click(object sender, EventArgs e)
        {

            if (this.txtFName.Text.Trim() == "")
            {
                XtraMessageBox.Show("文件夹名称不能为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            else
            {
                if (this.txtFName.Text.Trim().Length >= 255)
                {
                    XtraMessageBox.Show("文件名不能超过255个字符。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
                else
                {
                    NewName = this.txtFName.Text;
                    this.DialogResult = DialogResult.OK;
                }
            }
        }

        private void DirNameInputDlgForm_Load(object sender, EventArgs e)
        {
            if (commonDlgModel.ActionMethod == Model.ActionMethodType.Rename)
            {
                this.Text = "请输入新名称";
                if (commonDlgModel.StringList.Count > 0)
                {
                    this.txtFName.Text = commonDlgModel.StringList[0];
                }
            }
            else if (commonDlgModel.ActionMethod == Model.ActionMethodType.Newdir)
            {

            }
        }
    }
}
